/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Sik
 */
@Entity
@Table(name = "cotisation")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Cotisation.findAll", query = "SELECT c FROM Cotisation c"),
    @NamedQuery(name = "Cotisation.findByIdCotisation", query = "SELECT c FROM Cotisation c WHERE c.idCotisation = :idCotisation"),
    @NamedQuery(name = "Cotisation.findByAnnee", query = "SELECT c FROM Cotisation c WHERE c.annee = :annee"),
    @NamedQuery(name = "Cotisation.findByMontant", query = "SELECT c FROM Cotisation c WHERE c.montant = :montant")
})
public class Cotisation implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idCotisation")
    private Integer idCotisation;
    @Column(name = "annee")
    @Temporal(TemporalType.DATE)
    private Date annee;
    @Column(name = "montant")
    private Long montant;
    @ManyToMany(mappedBy = "cotisationList")
    private List<Adherent> adherentList;

    public Cotisation()
    {
    }

    public Cotisation(Integer idCotisation)
    {
        this.idCotisation = idCotisation;
    }

    public Integer getIdCotisation()
    {
        return idCotisation;
    }

    public void setIdCotisation(Integer idCotisation)
    {
        this.idCotisation = idCotisation;
    }

    public Date getAnnee()
    {
        return annee;
    }

    public void setAnnee(Date annee)
    {
        this.annee = annee;
    }

    public Long getMontant()
    {
        return montant;
    }

    public void setMontant(Long montant)
    {
        this.montant = montant;
    }

    @XmlTransient
    public List<Adherent> getAdherentList()
    {
        return adherentList;
    }

    public void setAdherentList(List<Adherent> adherentList)
    {
        this.adherentList = adherentList;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idCotisation != null ? idCotisation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cotisation))
        {
            return false;
        }
        Cotisation other = (Cotisation) object;
        if ((this.idCotisation == null && other.idCotisation != null) || (this.idCotisation != null && !this.idCotisation.equals(other.idCotisation)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Model.Cotisation[ idCotisation=" + idCotisation + " ]";
    }
    
}
